package com.cyandpos.pad.pay.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;


import com.cyandpos.pad.R;
import com.cyandpos.pad.posdata.DepositUseData;

import java.util.List;

/**
 * Created by pit on 2017/3/23.
 */

public class DepositUseAdapter extends BaseAdapter {
    private List<DepositUseData> depositInfoList; //数据
    private Context mContext;
    /**
     * 构造方法
     * @param yhqItemListList 显示的数据
     * @param context oderActivity
     */

    public DepositUseAdapter(List<DepositUseData> yhqItemListList, Context context) {
        this.depositInfoList = yhqItemListList;
        this.mContext = context;
    }

    @Override
    public int getCount() {
        return depositInfoList.size();
    }

    @Override
    public Object getItem(int i) {
        return depositInfoList.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder viewHolder = null;
        if(view==null){
            view = LayoutInflater.from(mContext).inflate(R.layout.deposit_use_item, null);
            viewHolder = new ViewHolder();
            viewHolder.tv_xh= (TextView)view.findViewById(R.id.tv_xh_deposituse_item);
            viewHolder.tv_djdh = (TextView)view.findViewById(R.id.tv_djdh_deposituse_item);
            viewHolder.tv_djje = (TextView)view.findViewById(R.id.tv_djje_deposituse_item);
            view.setTag(viewHolder);
        }
        else {
            viewHolder  = (ViewHolder)view.getTag();
        }
        DepositUseData item =depositInfoList.get(i);
        viewHolder.tv_xh.setText(item.getDepositInx()+"");
        viewHolder.tv_djje.setText(item.getDepositAmt()+"");
        viewHolder.tv_djdh.setText(item.getOrderNo()+"");

        return view;
    }
    private class ViewHolder{
        private TextView tv_xh;
        private TextView tv_djdh;
        private TextView tv_djje;
    }
}
